﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WinForm
{
    [Serializable]
    public partial class AccordionItem : UserControl
    {
        public bool bExpand { get; set; }
        
        public string text { 
            get{return label1.Text;}
            set { label1.Text= value;  }
        }

        private Color _hovercolor;
        private Color tempcolor ;
        
        public Color HoverColor {
            get { return _hovercolor; }
            set { _hovercolor = value; }
        }

        
        

        public Image img { get; set; }
        public AccordionItem()
        {
            InitializeComponent();
            this.MouseHover += new EventHandler(hover);
            this.MouseLeave += new EventHandler(leave);
            tableLayoutPanel1.MouseHover+=new EventHandler(hover);
            tableLayoutPanel1.MouseLeave+=new EventHandler(leave);
            label1.MouseHover+=new EventHandler(hover);
            label1.MouseLeave+=new EventHandler(leave);
            imgIcon.MouseHover+=new EventHandler(hover);
            imgIcon.MouseLeave+=new EventHandler(leave);
            //this.Refresh();           

        }

        void leave(object sender, EventArgs e)
        {
            this.BackColor = tempcolor;

        }

        protected override void OnCreateControl()
        {
            //this.Refresh();
        }
      
        private void AccordionItem_Load(object sender, EventArgs e)
        {

            
        }

        void hover(object sender, EventArgs e)
        {
            tempcolor = this.BackColor;
            this.BackColor = HoverColor;
        }
    }
}
